using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Input.Touch;

namespace WPCoco.Controllers
{
    public class TouchInputState
    {
        public TouchInputState()
        {
            TouchPanel.EnabledGestures = (GestureType)1023;
        }

        List<GestureSample> gestureSamples = new List<GestureSample>();

        public List<GestureSample> GestureSamples
        {
            get { return gestureSamples; }
            private set { gestureSamples = value; }
        }

        TouchCollection touchState = new TouchCollection();

        public TouchCollection TouchState
        {
            get { return touchState; }
            private set { touchState = value; }
        }

        public void Update() 
        {
            gestureSamples.Clear();
            while (TouchPanel.IsGestureAvailable)
            {
                GestureSample g = TouchPanel.ReadGesture();
                gestureSamples.Add(g);
            }
            touchState = TouchPanel.GetState();
        }

        public bool HasInformation() 
        {
            return gestureSamples.Count != 0 || touchState.Count != 0;
        }
    }
}
